#include "stdafx.h"
#include "MatEditorManager.h"
#include  "TempMat.h"

template<> MatEditorManager*  Ogitors::Singleton<MatEditorManager>::ms_Singleton = 0;

MatEditorManager::MatEditorManager(void)
{
}

MatEditorManager::~MatEditorManager(void)
{

}



 void MatEditorManager::deleteMatTep(BaseMat * base)
 {
 	for (VMATLIST::iterator i = m_VMATLIST.begin();i!=m_VMATLIST.end();	++i)
 	{
 		if ((*i)==base)
 		{
			delete (*i);
           m_VMATLIST.erase(i);
 		  break;
 		}
 	}
 }

BaseMat * MatEditorManager::CreateMatTep(const Ogre::String &name,Ogre::NameValuePairList &params,matUiEditor * pMat)
{

	Ogre::String matName = params["matName"];
	Ogre::String TempmatName = params["TempmatName"];
	BaseMat *pb = new TempMat(  TempmatName,  matName,  pMat);

	m_VMATLIST.push_back(pb);
	return pb;
}


void  MatEditorManager::exportMat(const Ogre::String & path)
{
  
	for (VMATLIST::iterator i = m_VMATLIST.begin();i!=m_VMATLIST.end();++i)
	{
		 (*i)->exportMat(path);
	}

}